﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PlainOldVersionControl.Data.Base;
using System.IO;

namespace PlainOldVersionControl.Data
{
    public class Settings
    {
        public static string Root = @".PlainOldVersionControl";
        private static string DBRoot = Path.Combine(Root, "DataBase");
        private static string OSRoot = Path.Combine(Root, "ObjectStore");
        private static string TempRoot = Path.Combine(Root, "Temp");

        public static string TempDirRoot { get { return TempRoot; } }
        public static string CurrentDatabase { get { return Path.Combine(DBRoot, "Plain.db"); } }
        public static string ObjectStoreRoot { get { return OSRoot; } }

        internal static void EnsureInit()
        {
            if (!Directory.Exists(Root))
                Directory.CreateDirectory(Root);

            if (!Directory.Exists(DBRoot))
                Directory.CreateDirectory(DBRoot);

            if (!Directory.Exists(OSRoot))
                Directory.CreateDirectory(OSRoot);

            if (!Directory.Exists(TempRoot))
                Directory.CreateDirectory(TempRoot);
        }
    }
}
